<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>处理中订单</title>
    <c:import url="../../header.jsp"/>
</head>
<body>
<div class="content-warp">
    <%--<div class="dgg-list-top-warp">--%>

        <div class="screen-tab-warp">
            <ul class="screen-tab">
                <li class="active tab-switch"  data-target="0"><a href="javascript:void(0)">待接收</a></li>
                <li class="tab-switch" data-target="1"><a href="javascript:void(0)">办理中</a></li>
                <li class="tab-switch" data-target="3"><a href="javascript:void(0)">已放款</a></li>
                <li class="tab-switch" data-target="2"><a href="javascript:void(0)">已暂缓</a></li>
            </ul>
        </div>
    <%--</div>--%>
    <div id="inProcessPage"></div>
</div>
</div>
<c:import url="../../footer.jsp"/>
<script>
    var processingOrder = {
        "list":sysInfo.basePath+"/rzsc/processing_order/list.do",//分页数据
        "waitAcceptPage":sysInfo.basePath+"/rzsc/processing_order/wait_accept.html",
        "inProcessPage":sysInfo.basePath+"/rzsc/processing_order/inProcess.html",
        "defedPage":sysInfo.basePath+"/rzsc/processing_order/defedOrder.html",
        "fkPage":sysInfo.basePath +"/all_order/completed_fk.html",
        "fkList":sysInfo.basePath +"/all_order/all_Order_json.do",//放款分页数据

    };
    var checkparam;
    var tables;
    var timeout = '${TIME_OUT}';
    var timeType = '${timeType}';
    var codes = '${codes}';
    dggui.use(['table', 'select2','distpicker','dggdate'], function (){
        var status=$(".active").attr("data-target");
        var table = dggui.table;
        var select2 = dggui.select2;
        var distpicker=dggui.distpicker;
        var dggdate = dggui.dggdate;
        //初始化加载表格
        if(!isEmpty(timeType)){
            $(".screen-tab li:eq(2)").addClass("active");
            $(".screen-tab li:eq(0)").removeClass("active");
            $(".screen-tab li:eq(1)").removeClass("active");
            $(".screen-tab li:eq(3)").removeClass("active");
            fangkuan();
        }else if(!isEmpty(codes)){
            $(".screen-tab li:eq(3)").addClass("active");
            $(".screen-tab li:eq(0)").removeClass("active");
            $(".screen-tab li:eq(1)").removeClass("active");
            $(".screen-tab li:eq(2)").removeClass("active");
            deferd();
        }else{
            waitReceive();
        }


        // console.log($(".active").attr("data-target"));
        $(".tab-switch").click(function () {

            var target = $(this).attr("data-target");
            $(".tab-switch").each(function () {
                if (target == $(this).attr("data-target")) {
                    $(this).addClass("active");
                } else {
                    $(this).removeClass("active");
                }
            })
            switch ($(".active").attr("data-target")) {
                case "0":
                    dggui.dialog.loading();
                   waitReceive();
                    break;
                case "1":
                    dggui.dialog.loading();
                  inProcess();
                    break;
                case "2":
                    dggui.dialog.loading();
                    deferd();
                    break;
                case "3":
                    dggui.dialog.loading();
                    fangkuan();
                    break;
            }
        })

        //待接收页面
        function waitReceive() {
            $.ajax({
                url: processingOrder.waitAcceptPage,
                data:{code:'${code}'},
                dataType: 'html',
                success: function (html) {
                    dggui.dialog.loading('close');
                    $("#inProcessPage").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                        placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "160px"
                    });

        /*            select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#productCode'),
                        width: "160px"
                    });*/
                    //初始化业务类型及产品
                    distpicker.render({
                        url: "${basePath}/rzsc/common/tree_book_list.do?code=BUS_YT_DK&type=2&level=2", // 请求地址
                        elem: '#typeCode', // 容器Id
                        type: 2,
                        placeholder: '选择业态',
                        defaultParentCode:'BUS_YT_DK',
                        callback:function () {//如果不需要选产品就把callback整个方法注释掉
                           /* var code = $("#typeCode .plug-in-code").val();
                            initProductCode("#productCode",code);
                            select2.render({
                                placeholder: "请选择",
                                allowClear: true,
                                elem: $('#productCode'),
                                width: "160px"
                            });*/
                       /*     var produtId = $("#productCode").val();
                            initChannel("#channelCode",produtId);
                            select2.render({
                                placeholder: "请选择",
                                allowClear: true,
                                elem: $('#channelCode'),
                                width: "160px"
                            });*/
                        },
                        callbackClear:function () {
                      /*      $("#productCode").find("option").remove();
                            $("#productCode").append("<option value=''>请选择</option>");
                            $("#channelCode").find("option").remove();
                            $("#channelCode").append("<option value=''>请选择</option>");*/
                        }
                    });
/*
                    $('#typeCode').on('change', function (e) {
                        var code = $("#typeCode .plug-in-code").val();
                        initProductCode("#productCode",code);
                        select2.render({
                            placeholder: "请选择",
                            allowClear: true,
                            elem: $('#productCode'),
                            width: "160px"
                        });*/
                    //渠道初始化
         /*           $('#productCode').on('change', function (e) {
                        var produtId = $("#productCode").val();

                        initChannel("#channelCode",produtId);
                        select2.render({
                            placeholder: "请选择",
                            allowClear: true,
                            elem: $('#channelCode'),
                            width: "160px"
                        });
                    });*/
                    // 加载部门下拉框
                    queryAllDep("#signOrg");

                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "160px"
                    });
                    //初始化签单商务
                    initUser("bus_advisor","role","#signUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#signUserId'),
                        width: "160px"
                    });
                  /*  //初始化接单时间
                    dggdate.render({
                        elem: '#signTime',
                        type: 'date',
                        range: '~'
                    });
                    //初始化分配时间
                    dggdate.render({
                        elem: '#allotDate',
                        type: 'date',
                        range: '~'
                    });*/
                    var opt={
                        "elem":"#waitOrder",
                        "ajax": processingOrder.list,
                        "scrollX": "true",//是否开启横项滚动
                        "paging": "true",
                        "switchStatus": "waitOrder",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                          /*  var moneyMax = $("#moneyMax").val().trim();
                            var moneyMin = $("#moneyMin").val().trim();*/
                            //搜索条件
                            aoData = $.extend(aoData, {
                                    target:$(".active").attr("data-target"),
                                    // customerPhone:$("#customerPhone").val(),
                                    // statusAttr:$("#orderStatus").val(),
                                    productOrgId:$("#productOrgId").val(),
                                    typeCode:$("#typeCode .plug-in-code").val(),
                                    // productId:$("#productCode").val(),
                                    // channelId:$("#channelCode").val(),
                                    flowUserId:$("#flowUserId").val(),
                                    signUserId:$("#signUserId").val(),
                                    // orderTime:$("#signTime").val(),
                                    // receiveOrderDate:$("#receiveOrderDate").val(),
                                    // allotDate:$("#allotDate").val(),
                                    searchKey:$("#searchKey").val(),
                                    signOrgOrBusId:$("#signOrg").attr("data-id"),
                                    customerName:$("#customerName").val(),
                               /*     moneyMax:moneyMax,
                                    moneyMin:moneyMin,*/
                                }
                            )
                            return aoData;
                        },
                        "aoColumns": [{
                            "sClass": "check-th",
                            "orderable": false,
                            "title": "<input type='checkbox'  class='checkall'>",
                            "render": function(data, type, full, meta) {
                                return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                            }
                        }, {
                            'title': '序号',
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return meta.row + 1;
                            }
                        },
                            {
                                'title': '所属生产事业部',
                                'data': "productOrgName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                'title': '生产订单编号',
                                'data': "scProductOrderNo",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="openOrderInfoDetail(\''+data+'\',\''+row.id+'\')">'+data+'</a>';
                                    return htm;
                                }
                            }, {
                                'title': '客户',
                                'data': "customerName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                        '<p><span>' +emptyStringConvert(row.customerName) + '</span></p>' +
                                        '<p>' + emptyStringConvert(row.customerPhone) + '</p>' +
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '当前完成节点',
                                'data': "latestEndNodeName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.latestEndNodeName) + '<p>' + emptyStringConvert(row.latestEndNodeTime) + '</p>';
                                }
                            },

                            {
                                'title': '业务类型',
                                'data': "businessProductName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data ? data : ''+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '产品',
                                'data': "productName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '商品属性',
                                'data': "goodsName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '渠道',
                                'data': "channelName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单时间',
                                "orderable": false,
                                'data': "orderTime",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '签单商务',
                                'data': "signUserName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.signUserName) + '<p>' + emptyStringConvert(row.signUserOrgName) + '</p>';
                                }
                            },
                            {
                                'title': '流程人员',
                                'data': "flowUserName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    return data ? data+'<p>'+emptyStringConvert(row.flowUserOrgName)+'</p>': '';
                                }
                            }, {
                                'title': '分配时间',
                                'data': "allotDate",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },{
                                'title': '来源方式',
                                'data': "originCode",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '需求金额（元）',
                                'data': "loanAmount",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '订单状态',
                                'data':"status",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '最新备注',
                                'data': "lastRemark",
                                "orderable": false,
                                "render": function (data, type, row, meta) {
                                    return '<div class="line1" title="'+data+'"><p>' + strInterception(data,10) + '</p></div>' + '<p>'+emptyStringConvert(row.lastRemarkTime)+'</p>';
                                }
                            },{
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="remarkOrder(\''+row.id+'\',$(\'#inProcessPage\'));">备注</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {

                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    console.log('订单超期');
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    console.log('节点超期');
                                    return;
                                } else if (rowData.receiveTimeStatus == timeout && (rowData.status == '下单待接收' || rowData.status == '移交待接收' ||rowData.status == '转单待接收' ||rowData.status == '退回待接收')) {//接收超期
                                    $(td).parent().addClass("purple");
                                    console.log('接收超期');
                                    return;
                                }
                            }
                        }]
                    };
                    tables=table.render(opt);
                    $('.searchBtn').click(function (){
                     /*   var moneyMax = $("#moneyMax").val().trim();
                        var moneyMin = $("#moneyMin").val().trim();
                        if(!checkMoneySearch(moneyMin,moneyMax)){
                            return false;
                        }*/
                        tables.ajax.reload();

                    });

                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                       if(checkEmpty(settings.jqXHR.responseJSON.error)){ dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        }

        function inProcess() {
            $.ajax({
                url: processingOrder.inProcessPage,
                dataType: 'html',
                success: function (html) {
                    dggui.dialog.loading('close');
                    $("#inProcessPage").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                        placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "160px"
                    });
                    //初始化节点信息
                    initAllNode("#nodeId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#nodeId'),
                        width: "160px"
                    });
                    //初始化订单状态
                   /* commonTreeBookCode("#orderStatus", "RZSCORDER_STATUS", 1, 1, 1, true);
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#orderStatus'),
                        width: "160px"
                    });*/
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#productCode'),
                        width: "160px"
                    });
                    //初始化业务类型及产品
                    distpicker.render({
                        url: "${basePath}/rzsc/common/tree_book_list.do?code=BUS_YT_DK&type=2&level=2", // 请求地址
                        elem: '#typeCode', // 容器Id
                        type: 2,
                        placeholder: '选择业态',
                        defaultParentCode:'BUS_YT_DK',
                        callback:function () {//如果不需要选产品就把callback整个方法注释掉
                            var code = $("#typeCode .plug-in-code").val();
                            initProductCode("#productCode",code);
                            select2.render({
                                placeholder: "请选择",
                                allowClear: true,
                                elem: $('#productCode'),
                                width: "160px"
                            });
                            var produtId = $("#productCode").val();
                            initChannel("#channelCode",produtId);
                            select2.render({
                                placeholder: "请选择",
                                allowClear: true,
                                elem: $('#channelCode'),
                                width: "160px"
                            });
                        },
                        callbackClear:function () {
                            $("#productCode").find("option").remove();
                            $("#productCode").append("<option value=''>请选择</option>");
                            $("#channelCode").find("option").remove();
                            $("#channelCode").append("<option value=''>请选择</option>");
                        }
                    });
                    // 加载部门下拉框
                    queryAllDep("#signOrg");
                    //渠道初始化
                    $('#productCode').on('change', function (e) {
                        var produtId = $("#productCode").val();
                        initChannel("#channelCode",produtId);
                        select2.render({
                            placeholder: "请选择",
                            allowClear: true,
                            elem: $('#channelCode'),
                            width: "160px"
                        });
                    });
                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "160px"
                    });
                    //初始化签单商务
                    initUser("bus_advisor","role","#signUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#signUserId'),
                        width: "160px"
                    });
                    //初始化协单人员
                   /* initUser("RZSC_FLOW_USER","role","#assistUser");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#assistUser'),
                        width: "160px"
                    });*/
                    //初始化签单时间
                    dggdate.render({
                        elem: '#signTime',
                        type: 'date',
                        range: '~'
                    });
                    //初始化接单时间
                    dggdate.render({
                        elem: '#receiveOrderDate',
                        type: 'date',
                        range: '~'
                    });
                    //初始化分配时间
                   /* dggdate.render({
                        elem: '#allotDate',
                        type: 'date',
                        range: '~'
                    });*/

                    var opt={
                        "elem":"#inProcess",
                        "ajax": processingOrder.list,
                        "scrollX": "true",//是否开启横项滚动
                        "switchStatus": "inProcess",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                          /*  var moneyMax = $("#moneyMax").val().trim();
                            var moneyMin = $("#moneyMin").val().trim();*/
                            //搜索条件
                            aoData = $.extend(aoData, {
                                    target:$(".active").attr("data-target"),
                                    // customerPhone:$("#customerPhone").val(),
                                    productOrgId:$("#productOrgId").val(),
                                    typeCode:$("#typeCode .plug-in-code").val(),
                                    productId:$("#productCode").val(),
                                    channelId:$("#channelCode").val(),
                                    // assist:$("#assist").val(),
                                    flowUserId:$("#flowUserId").val(),
                                    signUserId:$("#signUserId").val(),
                                    // assistId:$("#assistUser").val(),
                                    orderTime:$("#signTime").val(),
                                    receiveOrderDate:$("#receiveOrderDate").val(),
                                    // allotDate:$("#allotDate").val(),
                                    searchKey:$("#searchKey").val(),
                                    SQSTATUS: $("#SQSTATUS").val(),
                                    signOrgOrBusId:$("#signOrg").attr("data-id"),
                                   /* moneyMax:moneyMax,
                                    moneyMin:moneyMin,*/
                                    nodeName:$("#nodeId").val(),
                                    customerName:$("#customerName").val(),
                                }
                            )
                            return aoData;
                        },
                        "aoColumns": [{
                            "sClass": "check-th",
                            "title": "<input type='checkbox'  class='checkall'>",
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                            }
                        }, {
                            'title': '序号',
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return meta.row + 1;
                            }
                        },
                            {
                                'title': '所属生产事业部',
                                'data': "productOrgName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                'title': '生产订单编号',
                                "orderable": false,
                                'data': "scProductOrderNo",
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="openOrderInfoDetail(\''+data+'\',\''+row.id+'\')">'+data+'</a>';
                                    return htm;
                                }
                            }, {
                                'title': '客户',
                                "orderable": false,
                                'data': "customerName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                        '<p><span>' +emptyStringConvert(row.customerName) + '</span></p>' +
                                        '<p>' + emptyStringConvert(row.customerPhone) + '</p>' +
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '当前完成节点',
                                "orderable": false,
                                'data': "latestEndNodeName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.latestEndNodeName) + '<p>' + emptyStringConvert(row.latestEndNodeTime) + '</p>';
                                }
                            },

                            {
                                'title': '业务类型',
                                'data': "businessProductName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data ? data : ''+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '产品',
                                'data': "productName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '商品属性',
                                'data': "goodsName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '渠道',
                                "orderable": false,
                                'data': "channelName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '签单时间',
                                "orderable": false,
                                'data': "orderTime",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '签单商务/部门',
                                "orderable": false,
                                'data': "signUserName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.signUserName) + '<p>' + emptyStringConvert(row.signUserOrgName) + '</p>';
                                }
                            },
                            /*{
                                'title': '签单部门',
                                "orderable": false,
                                'data': "signUserOrgName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },*/
                            {
                                'title': '流程人员',
                                "orderable": false,
                                'data': "flowUserName",
                                "render": function(data, type, row, meta) {
                                    return data ? data+'<p>'+emptyStringConvert(row.flowUserOrgName)+'</p>': '';
                                }
                            },{
                                'title': '协单人员',
                                "orderable": false,
                                'data': "assistantName",
                                "render": function(data, type, row, meta) {
                                    var htm ='<div class="line1" title="'+data+'"><p>' + xdSubstring(data) + '</p></div>';
                                    return htm;
                                }
                            },

                            {
                                'title': '接单时间',
                                "orderable": false,
                                'data': "receiveOrderDate",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + emptyStringConvert(data)+ '</p></div>';
                                    return htm;
                                }
                            },{
                                'title': '来源方式',
                                "orderable": false,
                                'data': "originCode",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '需求金额（元）',
                                "orderable": false,
                                'data': "loanAmount",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '订单状态',
                                "orderable": false,
                                'data':"status",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '最新备注',
                                'data': "lastRemark",
                                "orderable": false,
                                "render": function (data, type, row, meta) {
                                    return '<div class="line1" title="'+data+'"><p>' + strInterception(data,10) + '</p></div>' + '<p>'+emptyStringConvert(row.lastRemarkTime)+'</p>';
                                }
                            },{
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="remarkOrder(\''+row.id+'\',$(\'#inProcessPage\'));">备注</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {
                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    console.log('订单超期');
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    console.log('节点超期');
                                    return;
                                } else if (rowData.receiveTimeStatus == timeout && (rowData.status == '下单待接收' || rowData.status == '移交待接收' ||rowData.status == '转单待接收' ||rowData.status == '退回待接收')) {//接收超期
                                    $(td).parent().addClass("purple");
                                    console.log('接收超期');
                                    return;
                                }
                            }
                        }]
                    };
                    tables=table.render(opt);
                    $('.searchBtn').click(function (){
                   /*     var moneyMax = $("#moneyMax").val().trim();
                        var moneyMin = $("#moneyMin").val().trim();
                        if(!checkMoneySearch(moneyMin,moneyMax)){
                            return false;
                        }*/
                        tables.ajax.reload();
                    });

                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                       if(checkEmpty(settings.jqXHR.responseJSON.error)){dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        }

        function deferd() {
            $.ajax({
                url: processingOrder.defedPage,
                dataType: 'html',
                success: function (html) {
                    dggui.dialog.loading('close');

                    $("#inProcessPage").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                        placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "160px"
                    });
                    //初始化节点信息
                 /*   initAllNode("#nodeId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#nodeId'),
                        width: "160px"
                    });*/
                    //初始化订单状态
                   /* commonTreeBookCode("#orderStatus", "RZSCORDER_STATUS", 1, 1, 1, true);
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#orderStatus'),
                        width: "160px"
                    });*/
                  /*  select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#productCode'),
                        width: "160px"
                    });*/
                    //初始化业务类型及产品

                    //渠道初始化
                /*    $('#productCode').on('change', function (e) {
                        var produtId = $("#productCode").val();
                        initChannel("#channelCode",produtId);
                        select2.render({
                            placeholder: "请选择",
                            allowClear: true,
                            elem: $('#channelCode'),
                            width: "160px"
                        });
                    });*/

                    // 加载部门下拉框
                    queryAllDep("#signOrg");
                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "160px"
                    });
                    //初始化签单商务
                    initUser("bus_advisor","role","#signUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#signUserId'),
                        width: "160px"
                    });
                    //初始化签单时间
                  /*  dggdate.render({
                        elem: '#signTime',
                        type: 'date',
                        range: '~'
                    });*/
                    //初始化接单时间
                    dggdate.render({
                        elem: '#receiveOrderDate',
                        type: 'date',
                        range: '~'
                    });
                    //初始化分配时间
                 /*   dggdate.render({
                        elem: '#allotDate',
                        type: 'date',
                        range: '~'
                    });*/
                    //初始化暂缓时间
                    dggdate.render({
                        elem: '#suspendTime',
                        type: 'date',
                        range: '~'
                    });

                    var opt={
                        "elem":"#defedOrder",
                        "ajax": processingOrder.list,
                        "scrollX": "true",//是否开启横项滚动
                        "switchStatus": "defedOrder",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                    /*        var moneyMax = $("#moneyMax").val().trim();
                            var moneyMin = $("#moneyMin").val().trim();*/
                            //搜索条件
                            aoData = $.extend(aoData, {
                                    target:$(".active").attr("data-target"),
                                    // customerPhone:$("#customerPhone").val(),
                                    productOrgId:$("#productOrgId").val(),
                                    // statusAttr:$("#orderStatus").val(),
                                    // typeCode:$("#typeCode .plug-in-code").val(),
                                    // productId:$("#productCode").val(),
                                    // channelId:$("#channelCode").val(),
                                    flowUserId:$("#flowUserId").val(),
                                    signUserId:$("#signUserId").val(),
                                    // orderTime:$("#signTime").val(),
                                    receiveOrderDate:$("#receiveOrderDate").val(),
                                    // allotDate:$("#allotDate").val(),
                                    suspendTime:$("#suspendTime").val(),
                                    searchKey:$("#searchKey").val(),
                                    signOrgOrBusId:$("#signOrg").attr("data-id"),
                               /*     moneyMax:moneyMax,
                                    moneyMin:moneyMin,*/
                                    nodeName:$("#nodeId").val(),
                                    customerName:$("#customerName").val(),
                                }
                            )
                            return aoData;
                        },
                        "aoColumns": [{
                            "sClass": "check-th",
                            "orderable": false,
                            "title": "<input type='checkbox'  class='checkall'>",
                            "render": function(data, type, full, meta) {
                                return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                            }
                        }, {
                            'title': '序号',
                            "orderable": false,
                            "render": function(data, type, full, meta) {
                                return meta.row + 1;
                            }
                        },
                            {
                                'title': '所属生产事业部',
                                'data': "productOrgName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render"><b>'+data ? data : ''+'<b></div>';
                                    return htm;
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href="javascript:;" class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                'title': '生产订单编号',
                                "orderable": false,
                                'data': "scProductOrderNo",
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="openOrderInfoDetail(\''+data+'\',\''+row.id+'\')">'+data+'</a>';
                                    return htm;
                                }
                            }, {
                                'title': '客户',
                                "orderable": false,
                                'data': "customerName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                        '<p><span>' +emptyStringConvert(row.customerName) + '</span></p>' +
                                        '<p>' + emptyStringConvert(row.customerPhone) + '</p>' +
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '当前完成节点',
                                "orderable": false,
                                'data': "latestEndNodeName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.latestEndNodeName) + '<p>' + emptyStringConvert(row.latestEndNodeTime) + '</p>';
                                }
                            },

                            {
                                'title': '业务类型',
                                'data': "businessProductName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data ? data : ''+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '产品',
                                'data': "productName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '商品属性',
                                'data': "goodsName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '渠道',
                                "orderable": false,
                                'data': "channelName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                           {
                                'title': '签单时间',
                                "orderable": false,
                                'data': "orderTime",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },

                            {
                                'title': '暂缓时间',
                                "orderable": false,
                                'data': "suspendTime",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '暂缓原因',
                                "orderable": false,
                                'data': "suspendReason",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '签单商务/部门',
                                "orderable": false,
                                'data': "signUserName",
                                "render": function(data, type, row, meta) {
                                    return emptyStringConvert(row.signUserName) + '<p>' + emptyStringConvert(row.signUserOrgName) + '</p>';
                                }
                            },
                            /*{
                                'title': '签单部门',
                                "orderable": false,
                                'data': "signUserOrgName",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },*/
                            {
                                'title': '流程人员',
                                "orderable": false,
                                'data': "flowUserName",
                                "render": function(data, type, row, meta) {
                                    return data ? data+'<p>'+emptyStringConvert(row.flowUserOrgName)+'</p>': '';
                                }
                            },
                            {
                                'title': '接单时间',
                                "orderable": false,
                                'data': "receiveOrderDate",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' +emptyStringConvert(data) + '</p></div>';
                                    return htm;
                                }
                            },{
                                'title': '来源方式',
                                "orderable": false,
                                'data': "originCode",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '需求金额（元）',
                                "orderable": false,
                                'data': "loanAmount",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },{
                                'title': '订单状态',
                                "orderable": false,
                                'data':"status",
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                'title': '最新备注',
                                'data': "lastRemark",
                                "orderable": false,
                                "render": function (data, type, row, meta) {
                                    return '<div class="line1" title="'+data+'"><p>' + strInterception(data,10) + '</p></div>' + '<p>'+emptyStringConvert(row.lastRemarkTime)+'</p>';
                                }
                            },
                            {
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href="javascript:void(0)" class="dggui-link" onclick="remarkOrder(\''+row.id+'\',$(\'#inProcessPage\'));">备注</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {

                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    console.log('订单超期');
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    console.log('节点超期');
                                    return;
                                } else if (rowData.receiveTimeStatus == timeout && (rowData.status == '下单待接收' || rowData.status == '移交待接收' ||rowData.status == '转单待接收' ||rowData.status == '退回待接收')) {//接收超期
                                    $(td).parent().addClass("purple");
                                    console.log('接收超期');
                                    return;
                                }
                            }
                        }]
                    };
                    tables=table.render(opt);
                    $('.searchBtn').click(function (){
                       /* var moneyMax = $("#moneyMax").val().trim();
                        var moneyMin = $("#moneyMin").val().trim();
                        if(!checkMoneySearch(moneyMin,moneyMax)){
                            return false;
                        }*/
                        tables.ajax.reload();
                    });

                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                       if(checkEmpty(settings.jqXHR.responseJSON.error)){dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        }
        //放款
        function fangkuan(){
            $.ajax({
                url:processingOrder.fkPage,
                dataType: 'html',
                success:function(html){
                    dggui.dialog.loading('close');
                    $("#inProcessPage").html(html);
                    //初始化所属生产事业部
                    syb("#productOrgId");
                    select2.render({
                        placeholder: "请选择",
                        elem: $('#productOrgId'),
                        allowClear: true,
                        width: "160px"
                    });
                    //初始化订单状态
                    /*commonTreeBookCode("#orderStatus", "RZSCORDER_STATUS", 1, 1, 1, true);
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#orderStatus'),
                        width: "160px"
                    });*/
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#productCode'),
                        width: "160px"
                    });
                    //初始化业务类型及产品
                    distpicker.render({
                        url: "${basePath}/rzsc/common/tree_book_list.do?code=BUS_YT_DK&type=2&level=2", // 请求地址
                        elem: '#typeCode', // 容器Id
                        type: 2,
                        placeholder: '选择业态',
                        defaultParentCode:'BUS_YT_DK',
                        callback:function () {//如果不需要选产品就把callback整个方法注释掉
                            var code = $("#typeCode .plug-in-code").val();
                            initProductCode("#productCode",code);
                            select2.render({
                                placeholder: "请选择",
                                allowClear: true,
                                elem: $('#productCode'),
                                width: "160px"
                            });
                            var produtId = $("#productCode").val();
                            initChannel("#channelCode",produtId);
                            select2.render({
                                placeholder: "请选择",
                                allowClear: true,
                                elem: $('#channelCode'),
                                width: "160px"
                            });
                        },
                        callbackClear:function () {
                            $("#productCode").find("option").remove();
                            $("#productCode").append("<option value=''>请选择</option>");
                            $("#channelCode").find("option").remove();
                            $("#channelCode").append("<option value=''>请选择</option>");
                        }
                    });
                    // 加载部门下拉框
                    queryAllDep("#signOrg");
                    //渠道初始化
                    $('#productCode').on('change', function (e) {
                        var produtId = $("#productCode").val();
                        initChannel("#channelCode",produtId);
                        select2.render({
                            placeholder: "请选择",
                            allowClear: true,
                            elem: $('#channelCode'),
                            width: "160px"
                        });
                    });
                    //初始化协单人员
                    initUser("RZSC_FLOW_USER","role","#assistUser");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#assistUser'),
                        width: "160px"
                    });
                    //初始化流程人员
                    initUser("RZSC_FLOW_USER","role","#flowUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#flowUserId'),
                        width: "160px"
                    });
                    //初始化签单商务
                    initUser("bus_advisor","role","#signUserId");
                    select2.render({
                        placeholder: "请选择",
                        allowClear: true,
                        elem: $('#signUserId'),
                        width: "160px"
                    });
                    //初始化放款时间
                    dggdate.render({
                        elem: '#loanTime',
                        type: 'date',
                        range: '~',
                        value: timeType,
                        isInitValue: true
                    });
                    //初始化签单时间
                    dggdate.render({
                        elem: '#signTime',
                        type: 'date',
                        range: '~',
                        value: timeType,
                        isInitValue: true
                    });
                    //初始化接单时间
                    dggdate.render({
                        elem: '#receiveOrderDate',
                        type: 'date',
                        range: '~',
                        value: timeType,
                        isInitValue: true
                    });
                    var opt={
                        "elem":"#completeOrderfk",
                        "ajax": processingOrder.fkList,
                        "scrollX": "true",//是否开启横项滚动
                        "selectCheck": false, //多选,同时选中复选框
                        "switchStatus": "completeOrderfk",
                        "fixedColumns": {//锁定列，只有开启scrollX时才生效
                            "leftColumns": 4,//左侧锁定2列
                            "rightColumns": 1//右侧锁定1列
                        },
                        "fnServerParams": function (aoData) {
                          /*  var moneyMax = $("#moneyMax").val().trim();
                            var moneyMin = $("#moneyMin").val().trim();*/
                            //搜索条件
                            //aoData = $.extend(aoData, $("#searchForm").serializeObject());
                            //aoData = $.extend(aoData, serializeObject($("#formComplete")));
                            aoData = $.extend(aoData, {
                                // customerPhone:$("#customerPhone").val(),
                                productOrgId:$("#productOrgId").val(),
                                /*statusAttr:$("#orderStatus").val(),*/
                                typeCode:$("#typeCode .plug-in-code").val(),
                                productId:$("#productCode").val(),
                                channelId:$("#channelCode").val(),
                                flowUserId:$("#flowUserId").val(),
                                // signTime:$("#signTime").val(),
                                receiveOrderDate:$("#receiveOrderDate").val(),
                                loanTime:$("#loanTime").val(),
                                signUserId:$("#signUserId").val(),
                                searchKey:$("#searchKey").val(),
                                completeState : $('#completeState').val(),
                                // assist:$("#assist").val(),
                                // assistId:$("#assistUser").val(),
                                signOrgOrBusId:$("#signOrg").attr("data-id"),
                          /*      moneyMax:moneyMax,
                                moneyMin:moneyMin,*/
                                customerName:$("#customerName").val(),
                            });
                            return aoData;
                        },
                        "aoColumns": [
                            {
                                "sClass": "check-th",
                                "title": '<input type="checkbox" class="checkall">',
                                "orderable": false,
                                "render": function(data, type, full, meta) {
                                    return '<input type="checkbox" class="checkchild" name="checkchild" value="' + data + '">';
                                }
                            },
                            {
                                "title": "序号",
                                "orderable": false,
                                "render": function(data, type, full, meta) {
                                    return meta.row + 1;
                                }
                            },
                            {
                                "title": "所属生产事业部",
                                "data": "productOrgName",
                                "orderable": false,
                                "render": function(data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title": "订单编号",
                                "orderable": false,
                                "data": "orderNo",
                                "render": function (data, type, full, meta) {
                                    return ('<a href=\'javascript:void(0)\' class="dggui-link"  onclick="openBusinessDetail(\'' + full.orderNo + '\',\'' + full.orderId + '\')" /><span>' + data + '</span></a>');
                                    /*return data;*/
                                }
                            },
                            {
                                "title": "生产订单编号",
                                "orderable": false,
                                "data": "scProductOrderNo",
                                "render": function (data, type, full, meta) {
                                    var result = "";
                                    result += '<a href="javascript:;"  class="dggui-link" onclick="openOrderInfoDetail(\'' + full.scProductOrderNo + '\',\'' + full.id + '\')" /><span>' + data + '</span></a>';
                                    return result;
                                }
                            },
                            {
                                "title": "客户",
                                "orderable": false,
                                "data": "customerName",
                                "render": function (data, type, full, meta) {
                                    return emptyStringConvert(full.customerName) + '<p>' + emptyStringConvert(full.customerPhone) + '</p>';
                                }
                            },
                            {
                                "title":"合同编号",
                                "orderable": false,
                                "data": "contractNo",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title": "当前完成节点",
                                "orderable": false,
                                "data": "latestEndNodeName",
                                "render": function (data, type, full, meta) {
                                    return emptyStringConvert(full.latestEndNodeName) + '<p>' + emptyStringConvert(full.latestEndNodeTime) + '</p>';
                                    /*return data;*/
                                }
                            },

                            {
                                "title":"业务类型",
                                "orderable": false,
                                "data": "businessProductName",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title":"产品",
                                "orderable": false,
                                "data": "productName",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                'title': '商品属性',
                                'data': "goodsName",
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p class="line1" title="'+data+'"><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"渠道",
                                "orderable": false,
                                "data": "channelName",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },

                            {
                                "title":"流程人员",
                                "orderable": false,
                                "data": "flowUserName",
                                "render": function (data, type, full, meta) {
                                    return data ? data+'<p>'+emptyStringConvert(full.flowUserOrgName)+'</p>': '';
                                   /*return data;*/
                                }
                            },{
                                'title': '协单人员',
                                "orderable": false,
                                'data': "assistantName",
                                "render": function(data, type, row, meta) {
                                    var htm ='<div class="line1" title="'+data+'"><p>' + xdSubstring(data) + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                'title': '签单时间',
                                "orderable": false,
                                'data': "orderTime",
                                "render": function(data, type, row, meta) {
                                    var htm =  '<div class="order-render"><p>' + data ? data : '' + '</p></div>';
                                    return htm;
                                }
                            },
                            {
                                "title":"签单商务/部门",
                                "orderable": false,
                                "data": "signUserName",
                                "render": function (data, type, full, meta) {
                                    return emptyStringConvert(full.signUserName) + '<p>' + emptyStringConvert(full.signUserOrgName) + '</p>';
                                  /* return data;*/
                                }
                            },
                            {
                                "title":"放款时间",
                                "orderable": false,
                                "data": "loanTime",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title":"接单时间",
                                "orderable": false,
                                "data": "receiveOrderDate",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title":"来源方式",
                                "orderable": false,
                                "data": "originCode",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title":"需求金额（元）",
                                "orderable": false,
                                "data": "loanAmount",
                                "render": function (data, type, full, meta) {
                                    var htm = '<div class="order-render">' +
                                    '<p><span >' +data ? data : '' + '</span></p>'+
                                        '</div>'
                                    return htm;
                                }
                            },
                            {
                                "title":"渠道返点",
                                "orderable": false,
                                "data": "channelRebates",
                                "render": function (data, type, full, meta) {
                                    return data ? data : '';
                                }
                            },
                            {
                                "title":"订单状态",
                                "orderable": false,
                                "data": "status",
                                "render": function (data, type, full, meta) {
                                    //return data+'<p>'+full.signUserOrgName+'</p>';
                                    return data;
                                }
                            },
                            {
                                'title': '最新备注',
                                'data': "lastRemark",
                                "orderable": false,
                                "render": function (data, type, row, meta) {
                                    return '<div class="line1" title="'+data+'"><p>' + strInterception(data,10) + '</p></div>' + '<p>'+emptyStringConvert(row.lastRemarkTime)+'</p>';
                                }
                            },
                            {
                                'title': '操作',
                                "orderable": false,
                                "render": function(data, type, row, meta) {
                                    var htm = '<a href=javascript:void(0)" class="dggui-link" onclick="remarkOrder(\''+row.id+'\',$(\'#completeOrderfk\'));">备注</a>';
                                    return htm;
                                }
                            }
                        ],
                        "columnDefs": [{
                            targets: [3], //第1，2，3列
                            createdCell: function (td, cellData, rowData, row, col) {
                                if (rowData.orderTimeStatus == timeout) {
                                    $(td).parent().addClass("red");//订单超期
                                    return;
                                } else if (rowData.nodeTimeStatus == timeout) {//节点超期
                                    $(td).parent().addClass("green");
                                    return;
                                }
                            }
                        }]
                    };
                    tables = table.render(opt);
                    $('.searchBtn').click(function (){
                    /*    var moneyMax = $("#moneyMax").val().trim();
                        var moneyMin = $("#moneyMin").val().trim();
                        if(!checkMoneySearch(moneyMin,moneyMax)){
                            return false;
                        }*/
                        tables.ajax.reload();
                    });
                    // 处理dataTable 异常错误信息
                    $.fn.dataTable.ext.errMode = 'none';//不抛出异常
                    tables.on( 'error.dt', function ( e, settings, techNote, message ) {
                        //dggui.dialog.errors("表格查询错误，请联系管理员", 2000);
                       if(checkEmpty(settings.jqXHR.responseJSON.error)){dggui.dialog.errors(settings.jqXHR.responseJSON.error, 2000);}
                    });
                }
            });
        }

    });

    function excelExportWaitReceive() {
      /*  var moneyMax = $("#moneyMax").val().trim();
        var moneyMin = $("#moneyMin").val().trim();*/
        /*if(!checkMoneySearch(moneyMin,moneyMax)){
            return;
        }*/
        var obj = new Object();
            obj.target=$(".active").attr("data-target");
            obj.customerPhone=$("#customerPhone").val();
            obj.statusAttr=$("#orderStatus").val();
            obj.productOrgId=$("#productOrgId").val();
            obj.typeCode=$("#typeCode .plug-in-code").val();
            obj.productId=$("#productCode").val();
            obj.channelId=$("#channelCode").val();
            obj.flowUserId=$("#flowUserId").val();
            obj.signUserId=$("#signUserId").val();
            obj.orderTime=$("#signTime").val();
            obj.receiveOrderDate=$("#receiveOrderDate").val();
            obj.allotDate=$("#allotDate").val();
            obj.searchKey=$("#searchKey").val();
            obj.assist=$("#assist").val();
            obj.assistId=$("#assistUser").val();
            obj.suspendTime=$("#suspendTime").val();
            obj.signOrgOrBusId=$("#signOrg").attr("data-id");
            obj.customerName = $("#customerName").val();
            obj.nodeNameExport=$("#nodeId").val();//节点编码,因nodename名称和jq冲突换个名称
           /* obj.moneyMax=moneyMax;
            obj.moneyMin=moneyMin;*/
        formSubmit('${basePath}/rzsc/processing_order/excel_export_processing_order.do', obj);
    };

    /**
     * 当协单人员过多时，只显示一个 然后其他用...号代替
     *
     */
    function xdSubstring(str){
        if(isEmpty(str)){
            return "";
        }
        if(str.indexOf(",") != -1){
            var result = str.split(",");
            return result[0]+"...";
        }
        return str;

    }

    /**
     * 导出放款
     * */
    function excelExportLoaned(url) {
      /*  var moneyMax = $("#moneyMax").val().trim();
        var moneyMin = $("#moneyMin").val().trim();
        if(!checkMoneySearch(moneyMin,moneyMax)){
            return;
        }*/
        var obj = new Object();
        // obj.customerPhone= $("#customerPhone").val();
        obj.productOrgId= $("#productOrgId").val();
        obj.typeCode= $("#typeCode").find(".plug-in-code").val();
        obj.productId= $("#productCode").val();
        obj.channelId=$("#channelCode").val();
        obj.loanTime=$("#loanTime").val();
        // obj.signTime=$("#signTime").val();
        obj.receiveOrderDate=$("#receiveOrderDate").val();
        obj.searchKey=$("#searchKey").val();
        obj.signUserId=$("#signUserId").val();
        obj.flowUserId=$("#flowUserId").val();
        obj.signOrgOrBusId=$("#signOrg").attr("data-id");
        // obj.receiveOrderDate=$("#receiveOrderDate").val();
        obj.customerName=$("#customerName").val();
       /* obj.moneyMax=moneyMax;
        obj.moneyMin=moneyMin;*/
        formSubmit(url, obj);
    }

</script>
</body>
</body>
</html>